const express = require("express");
let indexRouter = express.Router();
let pData = require("../data/product.json");

indexRouter.get("/productList",(req,res)=>{
    res.render("productList.ejs",{pData});
})

indexRouter.get("/productDetail",(req,res)=>{
    let {id} = req.query;
    let detailData =pData.find(item=>item.id==id);
    res.render("productDetail.ejs",{detailData});
})

module.exports = indexRouter;